package com.yiduo.outpost.core.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.yiduo.outpost.core.model.typehandlers.EnterpriseWechatType;
import com.yiduo.outpost.core.model.typehandlers.TextArrayTypeHandler;
import lombok.Data;

import java.time.Instant;
import java.util.List;

/**
 * @Author yanwen
 * @create 2021/8/26 5:42 下午
 */
@Data
@TableName("public.enterprise_wechats")
public class EnterpriseWechat {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Long advertiserAccountGroupId;
    private String agentId;
    private String suiteId;
    private String corpid;
    private String corpName;
    private String corpType;
    private String corpSquareLogoUrl;
    private String corpUserMax;
    private String corpFullName;
    private String subjectType;
    private String verifiedEndTime;
    private String corpWxqrcode;
    private String corpScale;
    private String corpIndustry;
    private String corpSubIndustry;
    private Integer oauthAgentId;
    @TableField(typeHandler = TextArrayTypeHandler.class)
    private String[] allowUser;
    /**
     * 企业微信类型
     * SERVICE_PROVIDER("服务商"),
     * BUILD_BY_ONESELF("自建应用"),
     * GENERATION_DEVELOPMENT("代开发应用"),
     */
    private EnterpriseWechatType enterpriseWechatType;
    /**
     * 自建应用的 encodingAesKey
     */
    private String encodingAesKey;
    private Integer isDelete;
    private String permanentCode;
    /**
     * 服务商应用对应的 token
     * 自建应用对应的token
     */

    private String token;
    private String corpSecret;
    private String accessToken;
    private Instant expiresAt;

    /**
     * url
     */
    private String url;

    /**
     * 最后一次的ip
     */
    private Long lastIpId;

    /**
     * 下线时间
     */
    private Instant offlineTime;

    /**
     * 加密的企业微信id
     */
    private String openCorpid;

    /**
     * 用户自定义-备注信息
     */
    private String customRemarks;


    /**
     * 联系我二维码初始化状态失败原因
     */
    private String wechatCustomerContactStateInitFailureReason;


    @TableField(fill = FieldFill.INSERT)
    private Instant createdAt;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Instant updatedAt;

    //如果是被分享的，这边要有一个转增来的字符串
    @TableField(exist = false)
    private String sharedText;

    @TableField(exist = false)
    private List<String> pmps;

    @TableField(exist = false)
    private Boolean openStatus;
}
